<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
      <functional-component :user-name="'zhangsan'"></functional-component>
    </div>
    <script src="vue.js"></script>
    <script>
        Vue.component('functional-component',{
            functional:true,//如果给组件配置对象设置了functional为true选项的话,就表示这是一个函数组件
            //render方法需要返回要渲染的虚拟DOM
            render(createElement,context){
                const {props} = context;
                //createElement是Vue中用来创建虚拟DOM的方法
                return createElement('p','hello '+props.userName);
            }
        });
        var vm = new Vue({
            el:'#app',
        });
    </script>
</body>
</html>